 <style>
        .file_bg{width:100px; height:auto; overflow:hidden; position:relative; margin:auto; float:left;}
        .file_bg input[type="button"]{ width:100px; height:36px; border-radius:0 4px 4px 0; border:#00B7EE solid 1px; text-align:center; font-size:13px; color:#fff; background:#00B7EE;}
        .file_bg input[type="file"]{width:100px; height:36px; position:absolute; z-index:1; top:0; left:0; opacity:0;}
        .value_name{ width:240px; height:34px; border:#eee solid 1px; border-radius:4px 0 0 4px; margin:auto; padding-left:10px; color:#666; font-size:13px; margin-bottom:20px; float:left;}
        .files_bg{ width:auto; height:auto; padding: 20px; border-radius:4px;  text-align:center; margin:auto; overflow:hidden;}
        .upload_btn{    background: none repeat scroll 0 0 #00B7EE; border:#00B7EE solid 1px;border-radius: 3px; color: #fff; cursor: pointer;font-size: 14px; margin-left: 10px; width:100px; height:36px; float:left}
        #numExport{position: absolute;top:19px;right:500px;}
        #numExport>div{display:inline-block}
 </style>
    <div style="padding: 20px">
        <form id="form1" class="form-inline" style="margin-bottom: 20px" action="{:U('index/searchId')}">
            <div class="form-group">
              <label for="exampleInputName2">姓名</label>
              <input type="text" class="form-control" id="exampleInputName2" placeholder="姓名" name="idname">
            </div>        
             <div class="form-group" style="margin-left:5px">
              <label for="exampleInputName3">身份证号码</label>
              <input type="text" class="form-control" id="exampleInputName3" placeholder="身份证号码" name="idcard">
            </div>        
            <button type="button" class="btn btn-default" id="search" style="margin-left:5px">搜索</button>          
        </form>
        
        <?php if($user_id == 1):?>
        <form action="{:U('Execl/numExport')}" method="post" id="numExport">
             <div class="form-group">
                 <input type="number" min="1" class="form-control" id="num" placeholder="导出数量" name="num" required="true">
             </div>     
             <button type="submit" class="btn btn-default" id="search" style="margin-left:5px">导出</button>          
        </form>
        <?php endif;?>
        
        <form action="{:U('Execl/export')}" method="post" enctype="multipart/form-data" style="position: absolute;right: 0px;top: 0;">
                <div class="files_bg">
                <input type="text" class="value_name" value="暂未选择文件" readonly="readonly">
                <div class="file_bg">
                    <input type="button" value="请选择文件"><input type="file" name="import">
                </div>
                <input class="upload_btn" type="submit" value="批量下载">
                </div>
        </form>
        
         <table class="table table-condensed table-bordered table-hover">
           <tr id="first_tr">
             <td>姓名</td>
             <td>身份证号码</td>
             <td>身份证照片</td>      
           </tr>
          <?php if(!empty($userInfo) && is_array($userInfo)):?> 
            <?php foreach ($userInfo as $k=>$v):?>
                  <tr>
                      <td style="text-align: center;vertical-align: middle;">{$v['idname']}</td>
                      <td style="text-align: center;vertical-align: middle;">{$v['idcard']}</td>
                      <td>
                        <?php if($v['idphoto'] != null):?>
                          <a href="__PUBLIC__/images/idphoto/{$v['idphoto']}" download="{$v['idname']}{$v['idcard']}"><img src="__PUBLIC__/images/idphoto/{$v['idphoto']}" style="width:600px;height:350px" class="img-thumbnail"></a>
                        <?php else:?>
                          暂无图片
                        <?php endif;?>
                      </td>     
             </tr>
             <?php endforeach;?>
           <?php endif;?>  
        </table>
        <div class="page" style="width:500px;margin: 0 auto">{$page}</div>
        <div style="position: fixed;right: 30px;bottom:20px;"><a href="{:U('index/download?type=xlsx')}">下载样本文件</a></div>
        <!--模态框开始-->
          <div class="modal fade" tabindex="-1" role="dialog" id="myModal">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <h4 class="modal-title">错误提示!</h4>
            </div>
              <div class="modal-body" id="content">

            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>   
            </div>
          </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
      </div><!-- /.modal -->
      <!--模态框结束-->
    </div>
    <script>
        $(function(){
                $('#search').click(function(){
                    var name = $.trim($('#exampleInputName2').val());
                    var idcard = $.trim($('#exampleInputName3').val());
                    if(name == '' && idcard == ''){
                         $('#content').html('<p>请至少输入一个查询条件!</p>'); 
                         $('#myModal').modal('show');
                    }else{
                        $('#form1').submit();
                    }
                });
            
            
                $('input[type="file"]').change(function(){
                        $('.value_name').val($('input[type="file"]').val())
                        if($('input[type="file"]').val()==''){
                                $('.value_name').val('暂未选择文件')
                                }
                        })
                $('.upload_btn').click(function(){
                        if($('input[type="file"]').val()==''){
                                $('#content').html('<p>请选择info.xlsx文件!</p>'); 
                                 $('#myModal').modal('show');
                                return false;	
                        }
                        })
                })
</script>
